package com.cf.r1046;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class b {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        int T = Integer.parseInt(br.readLine());
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        String[] in = br.readLine().split(" ");
        long n = Long.parseLong(in[0]);
        long k = Long.parseLong(in[1]);
        char[] s = br.readLine().toCharArray();

        int maxRun = 0, cur = 0;
        for (int i = 0; i < n; i++) {
            if (s[i] == '1') {
                cur++;
                if (cur > maxRun) maxRun = cur;
            } else {
                cur = 0;
            }
        }
        if (maxRun >= k) {
            out.println("NO");
            return;
        }
        long f = 1;
        long[] ans = new long[(int) n];
        for (int i = 0; i < n; i++) {
            if (s[i] == '1') {
                ans[i] = f++;
            }
        }
        for (int i = 0; i < n; i++) {
            if (s[i] == '0') {
                ans[i] = f++;
            }
        }
        out.println("YES");
        for (long a : ans) {
            out.print(a + " ");
        }
        out.println();
    }
}
